package br.affero.core.security;

import org.jboss.seam.security.Identity;
import org.jboss.seam.security.annotations.Secures;

import br.affero.core.security.annotations.Admin;
import br.affero.core.security.annotations.User;

public class SecurityRules {
	
	public @Secures @User boolean ownerChecker(Identity identity) {
		 
        if (identity.getUser() == null) {
            return false;
        } else {
            return true;
        }
    }
 
    public @Secures @Admin boolean adminChecker(Identity identity) {
        if (identity.getUser() == null) {
            return false;
        } else {
            return "admin".equals(identity.getUser().getId());
        }
    }
}
